<?php
	$fields_arr = array(
		'username'=>'会员账号',
		'total_cost'=>'累计消费(￥)',
		'real_name'=>'实名认证',
		'reg_time'=>'注册时间',
		'last_trade_time'=>'最后交易时间',
		'group_name'=>'所属分组',
		'status'=>'状态',
		'last_login_ip'=>'上次登陆ip',
		'operation'=>'操作',
	);
	if(!$custom_field_arr){
		$custom_field_arr = array_flip($fields_arr);
	}
	$fields_arr_new = array_merge($custom_field_arr,array_flip($fields_arr));
	$fields_arr_new = array_unique($fields_arr_new);
?>
{include app:admin.inc.header}
<!--tmpl-resource-->
{include app:admin.inc.top}
<link rel="stylesheet" href="/res/js/framework/nestable/nestable.css">
<div class="container-fluid content-body">
	<div class="main">
		<!-- left side start-->

		<section class="left-section">
			<dl id="leftNav" data-type="member">
				<dt><i class="glyphicon glyphicon-user"></i> 会员管理</dt>
				{if in_case_array('admin/member',$priv) || empty($priv)}
				<dd><a class="mb active" href="{url /admin/member/index}">会员列表</a></dd>
				{/if}{if in_case_array('admin/membergroup',$priv) || empty($priv)}
				<dd><a class="mbh" href="{url /admin/memberGroup/index}">分组管理</a></dd>
				{/if}
			</dl>
		</section>

		<!-- left side end-->

		<!-- main content start-->
		<section class="right-section" id="right-section">
			{include admin.inc.bread}
			<h2 class="header">{$title}</h2>
			<!-- start of inner-frame -->
			<div class="inner-iframe">
				<div class="inner-container">
					<form class="form-inline search-form" role="form" id="J_List_Form">
						<nav class="inline-form">
							<a class="btnlg mb" href="{$add_url}"><i class="css-add"></i>添加会员</a>
							<div class="r">
								<div class="css-select-group">
									<div class="css-select">
										<div class="chosen">
											<span></span>
											<i class="angle-down"></i>
											<input type="hidden" name="s_type" value="{$s_type}">
										</div>
										<ul>
											<li data-value="1">会员账号</li>
											<li data-value="2">实名认证</li>
										</ul>
									</div><input type="text" class="form-control input-sm" maxlength="{maxlength}" placeholder="关键字" name="s_keyword" value="{$s_keyword}">
								</div>
								<!-- searchdatetime -->
								<div class="form-group">
									<div class="input-group">
										<div class="input-group-addon">
											注册时间
										</div>
										<input style="width:100px;" class="form-control form-control-inline input-sm mdate"  size="16" type="text"
											   name="s_s_reg_time" value="{$s_s_reg_time}"
											   placeholder="开始时间" />

										<div class="input-group-addon">
											-
										</div>
										<input style="width:100px;" class="form-control form-control-inline input-sm mdate"  size="16" type="text"
											   name="s_e_reg_time" value="{$s_e_reg_time}"
											   placeholder="结束时间" />
									</div>
								</div>

								<input type="hidden" name="order" value="{$order}">
								<button type="submit" class="btnlg mb">搜索</button>
								<input type="hidden" name="pagesize" value="{$pagesize}" >
								<button type="button" class="btnlg mb" id="J_Export_btn">导出Excel</button>
								<button type="button" class="btnlg mb" id="defined">配置列表项</button>
							</div>
						</nav>




						<!-- search form end -->
					<!--</form>
					<form id="J_List_Form">-->
						<div class="table-responsive">
							<table id="J_ListTable" class="table  table-hover  table-striped">
								<thead>
									<tr>
										<th width="20">
											<label class="css-checkbox">
												<input type="checkbox" class="check-all">
												<span></span>
											</label>
                                        </th>
										{loop $custom_field_arr $k $v}
										<th>{$fields_arr[$v]}</th>
										{/loop}
									</tr>
								</thead>
								<tbody>
								{if empty($items)}
								<tr>
									<td style="text-align:center;" colspan="14" class="empty-table-td">{$emptyRecord}</td>
								</tr>
								{/if}
								{loop $items $value}
								<tr>
									<td>
										<label class="css-checkbox">
											<input type="checkbox"  name="ids[]" value="{$value[id]}">
											<span></span>
										</label>
									</td>
									{loop $custom_field_arr $v}
									{if $v=='status'}
									<td>
										<label class="css-switch">
											<input type="checkbox" data-field="status" data-size="mini"
												   {if $value[status]=='1'}checked{/if} {if $value[total]}disabled="disabled"{else}data-id="{$value[id]}"{/if}data-on-text="启用" data-off-text="禁用">
											<span></span>
										</label>
									</td>
									{else}
									{if $v=='operation'}
									<td>
										{if (in_array('admin/member/bind',$priv) || empty($priv)) && empty($value[dasu_pay_id])}
										<a href="#" data-id={$value[id]} data-username="{$value[username]}" class="btnsm-success item-bind">绑定</a>
										{/if}
										{if in_array('admin/member/edit',$priv) || empty($priv)}
										<a href="{$edit_url}?id={$value[id]}" class="btnsm-primary">编辑</a>
										{/if}
										{if in_array('admin/member/delete',$priv) || empty($priv)}
										<a href="{$delete_url}?id={$value[id]}" class="btnsm-danger item-remove">删除</a>
										{/if}
									</td>
									{else}
									<td>{$value[$v]}</td>
									{/if}
									{/if}
									{/loop}
								</tr>
								{/loop}
							</table>

						</div>
						
					</form>
                    <div class="footer">

                            <!--批量操作 start-->
                            <div class="btn-group dropup" data-act="operateAll">
                                <button class="btnlg mb dropdown-toggle" data-toggle="dropdown" aria-expanded="false" disabled>批量操作<span class="caret"></span></button>
                                <ul class="dropdown-menu" role="menu">
                                    <li><a href="javascript:;" data-action="on">启用</a></li>
                                    <li><a href="javascript:;" data-action="off">禁用</a></li>
                                    {if in_array('admin/member/delete',$priv) || empty($priv)}
                                    <li><a href="javascript:;" data-action="delete">删除</a></li>
                                    {/if}
                                </ul>
                            </div>
                            <!--批量操作 end-->
                            {$pagemenu}

                    </div>
				</div>
			</div>
		</section>
	</div>
</div>

<!--footer section start-->
{include admin.inc.footer}
<!--footer section end-->

<!--tmpl-script-->

<!-- template -->
<!--自定义start-->
<script id="defined_table" type="text/html">
	<div>
		<form id="defined_edit" class="form-horizontal">
			<input type="hidden" name="url" value="{$module}/{$action}/{$method}">
			<div class="de_title"><i></i>拖动改变顺序</div>
			<div class="cf">
				<div class="dd" id="nestable3">
					<ol class="dd-list">
						{loop $fields_arr_new $v}
						<li class="dd-item dd3-item" data-id="{$v}">
							<div class="dd-handle dd3-handle"></div><div class="dd3-content">
							<label class="css-checkbox">
								<input type="checkbox" {if in_array($v,$custom_field_arr)}checked="checked"{/if} name="field_arr[]" value="{$v}">
								<span>{$fields_arr[$v]}</span>
							</label>
						</div>
						</li>
						{/loop}
					</ol>
				</div>
			</div>
		</form>
	</div>
</script>
<!--自定义end-->

<script type="text/html" id="content-add-template">

	<form role="form" class="content-add-form" id="content-add-form" autocomplete="off">

		<div class="form-element">
			<div class="form-group">
				<label><span class="asterisk">*</span>大塑账户</label>
				<input type="password" style="position: absolute;left:-9999px;opacity: 0;">
				<input type="text" name="data[username]" value="" class="form-control" maxlength="15" placeholder="请输入大塑账户" dtype="mobile" required cname="大塑账户"/>
			</div>
			<p class="help-block"></p>
		</div>
		<div class="form-element">
			<div class="form-group">
				<label><span class="asterisk">*</span>登陆密码</label>
				<input type="password" name="data[password]" value="" class="form-control" maxlength="15" placeholder="请输入登陆密码" required cname="登陆密码"/>
			</div>
			<p class="help-block"></p>
		</div>
		<input type="hidden" name="data[app_userid]" value="{[item.id]}">
		<input type="hidden" name="data[app_username]" value="{[item.username]}">
	</form>
</script>

<!-- pagescript -->
<script type="text/javascript">
	seajs.use("admin/memberindex",function (exports){

		<!--tmpl-templatejavascript-->
		/*parameter.detailUrl="{$detail_url}";
		parameter.deleteUrl="{$delete_url}";
		parameter.editUrl="{$do_edit_url}";
		parameter.upload_url="{$upload_url}";
		parameter.image_search_url="{$image_search_url}";
		parameter.image_list_url="{$image_list_url}";
		
		parameter.init();	*/
		exports.init({
			set_url : '/admin/member/set/',
			bind_url : '/admin/member/do_bind',
			insert_url : '{$insert_url}',
			edit_url : '{$edit_url}',
			update_url : '{$update_url}'
		});
	});
</script>


<script id="assocpage" type="text/html">
<div class="text-right">
	<ul class="pagination blog-pagination">
		<li><a class="assoc-page" data-page="{[prev]}" href="javascript:void(0);">上一页</a></li> 
		{[loop pages page]}

		<li {[if curr == page]}class="active"{[/if]}><a class="assoc-page" data-page="{[page]}"  href="javascript:void(0)">{[page]}</a></li> 

		{[/loop]}
		<li><a class="assoc-page" href="javascript:void(0);" data-page="{[nexts]}">下一页</a></li> 
	</ul>	
</div>
</script>
</body>
</html>
